import { defineStore } from 'pinia'

export const useAppStore = defineStore('app', {
  state: () => ({
    locale: localStorage.getItem('language') || 'zh-cn',
    mode: localStorage.getItem('vueuse-color-scheme') || 'light'
  }),
  actions: {
    setStoreLocale(lang: string) {
      localStorage.setItem('language', lang)
      this.locale = lang
    },
    setMode(mode: string) {
      this.mode = mode
    }
  }
})
